package com.wty.cmims.controller;

import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.AppointmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/appointment")
@Tag(name = "预约信息", description = "社区医疗信息后台管理系统api接口")
public class AppointmentController {
    @Autowired
    private AppointmentService appointmentService;

    // 获取预约列表
    @PostMapping("/findAppointment")
    @Operation(summary = "获取预约列表", description = "获取预约列表")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> appointmentsFind(@RequestBody Map<String, Object> paramsMap) {
        return appointmentService.appointmentsFind(paramsMap);
    }

    // 修改预约信息
    @PutMapping("/update")
    @Operation(summary = "更改预约状态", description = "更改预约状态")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> appointmentUpdate(@RequestBody Map<String,Object> paramsMap){
        return appointmentService.appointmentUpdate(paramsMap);
    }
}